﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;

namespace Presentation
{
	static class Program
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main()
		{
			if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + "\\Movies Posters"))
				Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + "\\Movies Posters");
			if (!File.Exists(new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\DoubleFeature").FullName + "\\Resources\\movies.sqlite"))
			{
				Directory.CreateDirectory(new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\DoubleFeature").FullName + "\\Resources");
				File.Copy("Resources\\movies.sqlite", new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\DoubleFeature").FullName + "\\Resources\\movies.sqlite");
				Logic.Properties.Settings.Default.UpgradedDatabase = true;
				Logic.Properties.Settings.Default.Save();
			}
			else
			{
				Logic.Helper helper = new Logic.Helper();

				Logic.Properties.Settings.Default.UpgradedDatabase = helper.IsDatabaseUpgraded();
				Logic.Properties.Settings.Default.Save();
			}
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			Application.Run(new Main());
		}
	}
}
